package com.aspose.cells;

import java.util.ArrayList;
import java.util.Iterator;

class zcdf {
   private zok a;
   private com.aspose.cells.a.f.zj b;
   private zcel c;
   private com.aspose.cells.b.a.d.zh d;
   private zazw e;

   zcdf(zok var1, zcel var2, com.aspose.cells.a.f.zj var3, zazw var4) {
      this.a = var1;
      this.b = var3;
      this.c = var2;
      this.e = var4;
   }

   private void a(String var1) throws Exception {
      this.d.b();
      zcel.a(var1, this.d, this.b);
      this.d.a();
      this.d = null;
   }

   void a() throws Exception {
      this.d = new com.aspose.cells.b.a.d.zh();
      zbzp var1 = new zbzp(this.e);
      var1.a(this.d);
      Iterator var2 = this.e.iterator();

      while(var2.hasNext()) {
         zazv var3 = (zazv)var2.next();
         zcab var4 = new zcab(var3);
         var4.a(this.d);
      }

      zcdb.a(403, this.d);
      this.a("xl/revisions/revisionHeaders.bin");
   }

   void b() throws Exception {
      if (this.e.n != null) {
         this.d = new com.aspose.cells.b.a.d.zh();
         zcdb.a(399, this.e.n.getCount(), 2, this.d);
         zcdb.a(401, this.d);
         Iterator var1 = this.e.n.iterator();

         while(var1.hasNext()) {
            zbaf var2 = (zbaf)var1.next();
            zcal var3 = new zcal(var2);
            var3.a(this.d);
         }

         zcdb.a(403, this.d);
         this.a("xl/revisions/userNames.bin");
      }
   }

   void a(String var1, zazv var2) throws Exception {
      this.d = new com.aspose.cells.b.a.d.zh();
      Iterator var3 = var2.c.iterator();

      while(var3.hasNext()) {
         zazh var4 = (zazh)var3.next();
         switch(var4.a()) {
         case 0:
            zazo var8 = (zazo)var4;
            this.a(var8);
            break;
         case 1:
            this.a((zazp)var4);
            break;
         case 2:
            zazj var5 = (zazj)var4;
            this.a(var5);
            break;
         case 3:
            this.a((zazi)var4);
         case 4:
         case 9:
         default:
            break;
         case 5:
            this.a((zazk)var4);
            break;
         case 6:
            zazq var6 = (zazq)var4;
            this.a(var6);
            break;
         case 7:
            zazu var9 = (zazu)var4;
            this.a(var9);
            break;
         case 8:
            this.a((zazm)var4);
            break;
         case 10:
            this.a((zazz)var4);
            break;
         case 11:
            zazt var7 = (zazt)var4;
            this.a(var7);
            break;
         case 12:
            this.a((zbab)var4);
         }
      }

      zcdb.a(403, this.d);
      this.a(var1);
   }

   private void a(zazz var1) throws Exception {
      zcah var2 = new zcah(var1, this.a.a);
      var2.a(this.d);
   }

   private void a(zazi var1) throws Exception {
      zbzx var2 = new zbzx(var1, this.a.a);
      var2.a(this.d);
   }

   private void a(zazk var1) throws Exception {
      zcaf var2 = new zcaf(var1, this.a.a);
      var2.a(this.d);
   }

   private void a(zazp var1) throws Exception {
      zbzz var2 = new zbzz(var1, this.a.a);
      var2.a(this.d);
   }

   private void a(zazm var1) throws Exception {
      zcae var2 = new zcae(var1, this.a.a);
      var2.a(this.d);
      if (var1.i != null && var1.i.getCount() > 0) {
         Iterator var3 = var1.i.iterator();

         while(var3.hasNext()) {
            zazh var4 = (zazh)var3.next();
            switch(var4.a()) {
            case 2:
               zazj var5 = (zazj)var4;
               this.a(var5);
               break;
            case 6:
               zazq var6 = (zazq)var4;
               this.a(var6);
            }
         }
      }

      zcdb.a(408, this.d);
   }

   private void a(zazo var1) throws Exception {
      zcai var2 = new zcai(var1, this.a.a);
      var2.a(this.d);
   }

   private void a(zazu var1) throws Exception {
      zcad var2 = new zcad(var1, this.a.a);
      var2.a(this.d);
   }

   private void a(zbab var1) throws Exception {
      zcag var2 = new zcag(var1, this.a.a);
      var2.a(this.d);
   }

   private void a(zazt var1) throws Exception {
      zcac var2 = new zcac(var1, this.a.a);
      var2.a(this.d);
      if (var1.j != null && var1.j.getCount() > 0) {
         Iterator var3 = var1.j.iterator();

         while(var3.hasNext()) {
            zazh var4 = (zazh)var3.next();
            switch(var4.a()) {
            case 2:
               zazj var5 = (zazj)var4;
               this.a(var5);
               break;
            case 6:
               zazq var6 = (zazq)var4;
               this.a(var6);
            }
         }
      }

      zcdb.a(406, this.d);
   }

   private void a(zazq var1) throws Exception {
      zcaa var2 = new zcaa(var1, this.a.a);
      var2.a(this.d);
      if (var1.b != null) {
         this.a(var1.b);
      }

      zcdb.a(420, this.d);
   }

   private void a(zazj var1) throws Exception {
      zbzy var2 = new zbzy(var1, this.a.a);
      var2.a(this.d);
      if (var2.a != null) {
         var2.a.a(this.d);
      }

      if (var2.b != null) {
         var2.b.a(this.d);
      }

      if (var1.r != null) {
         this.a(var1.r);
      }

      if (var1.s != null) {
         this.a(var1.s);
      }

      zcdb.a(410, this.d);
   }

   private void a(zbac var1) throws Exception {
      zcdb.a(505, 1, 4, this.d);
      zcbo var2 = new zcbo();
      var2.a(var1.c, var1.b, this.e.o);
      var2.a(this.d);
      zcdb.a(506, this.d);
   }

   static int a(zazl var0) {
      if (var0.h != null) {
         return 5;
      } else {
         switch(var0.b()) {
         case 0:
         case 2:
            return 4;
         case 1:
         case 4:
            return 2;
         case 3:
            return 0;
         case 5:
            return 3;
         default:
            return 0;
         }
      }
   }

   static int a(byte[] var0, int var1, Font[] var2) {
      byte var3 = 0;
      if (var2 != null && var2.length != 0) {
         System.arraycopy(com.aspose.cells.b.a.zc.a(var2.length * 100), 0, var0, var3, 4);
         int var7 = var3 + 4;

         for(int var4 = 0; var4 < var2.length; ++var4) {
            Font var5 = var2[var4];
            System.arraycopy(com.aspose.cells.b.a.zc.a(var5.getName().length()), 0, var0, var7, 2);
            var7 += 2;
            System.arraycopy(Encoding.getUnicode().a(var5.getName()), 0, var0, var7, var5.getName().length() * 2);
            var7 += var5.getName().length() * 2;
            System.arraycopy(com.aspose.cells.b.a.zc.a(var5.i()), 0, var0, var7, 4);
            var7 += 4;
            int var6 = 0;
            if (var5.isItalic()) {
               var6 |= 2;
            }

            if (var5.isStrikeout()) {
               var6 |= 128;
            }

            System.arraycopy(com.aspose.cells.b.a.zc.a(var6), 0, var0, var7, 4);
            var7 += 4;
            System.arraycopy(com.aspose.cells.b.a.zc.a(var5.g()), 0, var0, var7, 2);
            var7 += 2;
            var0[var7] = var5.e();
            var7 += 2;
            switch(var5.getUnderline()) {
            case 0:
               var0[var7] = 0;
               break;
            case 1:
               var0[var7] = 1;
               break;
            case 2:
               var0[var7] = 2;
               break;
            case 3:
               var0[var7] = 33;
               break;
            case 4:
               var0[var7] = 34;
            }

            ++var7;
            var0[var7] = var5.d;
            ++var7;
            var0[var7] = var5.a;
            var7 += 2;
            var7 += 8;
            switch(var5.k()) {
            case 1:
               var0[var7] = 1;
               break;
            case 2:
               var0[var7] = 2;
            }

            var7 += 4;
            zcdb.a(var0, var7, var5.b, 32767, var5.c.n());
         }

         return var1 + var2.length * 100;
      } else {
         return var3;
      }
   }

   static void a(ArrayList var0, byte[] var1, int var2) {
      if (var0 != null && var0.size() != 0) {
         int var4 = var0.size();
         var4 = var4 / 16 * 16 + (var4 % 16 == 0 ? 0 : 16);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var4), 0, var1, var2, 4);
         int var3 = var2 + 4;

         for(int var5 = 0; var5 < var0.size(); ++var5) {
            CellArea var6 = (CellArea)var0.get(var5);
            a(var6, var1, var3);
            var3 += 16;
         }

      } else {
         System.arraycopy(com.aspose.cells.b.a.zc.a((int)-1), 0, var1, var2, 4);
      }
   }

   static void a(CellArea var0, byte[] var1, int var2) {
      System.arraycopy(com.aspose.cells.b.a.zc.a(var0.StartRow), 0, var1, var2, 4);
      System.arraycopy(com.aspose.cells.b.a.zc.a(var0.EndRow), 0, var1, var2 + 4, 4);
      System.arraycopy(com.aspose.cells.b.a.zc.a(var0.StartColumn), 0, var1, var2 + 8, 4);
      System.arraycopy(com.aspose.cells.b.a.zc.a(var0.EndColumn), 0, var1, var2 + 12, 4);
   }
}
